package org.jivesoftware.smack.proxy;

import javax.net.SocketFactory;

public class ProxyInfo
{
  private String proxyAddress;
  private String proxyPassword;
  private int proxyPort;
  private ProxyType proxyType;
  private String proxyUsername;

  public ProxyInfo(ProxyType paramProxyType, String paramString1, int paramInt, String paramString2, String paramString3)
  {
    this.proxyType = paramProxyType;
    this.proxyAddress = paramString1;
    this.proxyPort = paramInt;
    this.proxyUsername = paramString2;
    this.proxyPassword = paramString3;
  }

  public static ProxyInfo forDefaultProxy()
  {
    return new ProxyInfo(ProxyType.NONE, null, 0, null, null);
  }

  public static ProxyInfo forHttpProxy(String paramString1, int paramInt, String paramString2, String paramString3)
  {
    return new ProxyInfo(ProxyType.HTTP, paramString1, paramInt, paramString2, paramString3);
  }

  public static ProxyInfo forNoProxy()
  {
    return new ProxyInfo(ProxyType.NONE, null, 0, null, null);
  }

  public static ProxyInfo forSocks4Proxy(String paramString1, int paramInt, String paramString2, String paramString3)
  {
    return new ProxyInfo(ProxyType.SOCKS4, paramString1, paramInt, paramString2, paramString3);
  }

  public static ProxyInfo forSocks5Proxy(String paramString1, int paramInt, String paramString2, String paramString3)
  {
    return new ProxyInfo(ProxyType.SOCKS5, paramString1, paramInt, paramString2, paramString3);
  }

  public String getProxyAddress()
  {
    return this.proxyAddress;
  }

  public String getProxyPassword()
  {
    return this.proxyPassword;
  }

  public int getProxyPort()
  {
    return this.proxyPort;
  }

  public ProxyType getProxyType()
  {
    return this.proxyType;
  }

  public String getProxyUsername()
  {
    return this.proxyUsername;
  }

  public SocketFactory getSocketFactory()
  {
    Object localObject;
    if (this.proxyType == ProxyType.NONE)
      localObject = new DirectSocketFactory();
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            return localObject;
            if (this.proxyType != ProxyType.HTTP)
              break;
            localObject = new HTTPProxySocketFactory(this);
          }
          if (this.proxyType != ProxyType.SOCKS4)
            break;
          localObject = new Socks4ProxySocketFactory(this);
        }
        if (this.proxyType != ProxyType.SOCKS5)
          break;
        localObject = new Socks5ProxySocketFactory(this);
      }
      localObject = null;
    }
  }

  public static enum ProxyType
  {
    static
    {
      HTTP = new ProxyType("HTTP", 1);
      SOCKS4 = new ProxyType("SOCKS4", 2);
      SOCKS5 = new ProxyType("SOCKS5", 3);
      ProxyType[] arrayOfProxyType = new ProxyType[4];
      arrayOfProxyType[0] = NONE;
      arrayOfProxyType[1] = HTTP;
      arrayOfProxyType[2] = SOCKS4;
      arrayOfProxyType[3] = SOCKS5;
      ENUM$VALUES = arrayOfProxyType;
    }
  }
}